import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Antd);
Vue.use(ElementUI);
Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
  console.log(to.path);
  if (to.path !== "/login" ) {
      var token = sessionStorage.getItem("accessToken");
      if (token === null || token === undefined) {
          next('/login')
      } else {
          next();
      }
  } else {
      next();
  }
})

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app')
